
export const setItem = (name, obj) => {
  localStorage.setItem(name, JSON.stringify(obj))
}

export const getItem = (name) => {
  return JSON.parse(localStorage.getItem(name))
}

export const removeItem = (name) => {
  localStorage.removeItem(name)
}
const historyKey = 'search-history'

export const setHistory = (arr) => {
  localStorage.setItem(historyKey, JSON.stringify(arr))
}

export const getHistory = () => {
  return JSON.parse(localStorage.getItem(historyKey)) || []
}
